!function (t, e) {
    "object" == typeof exports && "object" == typeof module ? module.exports = e(require("tim-js-sdk")) : "function" == typeof define && define.amd ? define(["tim-js-sdk"], e) : "object" == typeof exports ? exports.TSignaling = e(require("tim-js-sdk")) : t.TSignaling = e(t.TIM)
}(window, (function (t) {
    return function (t) {
        var e = {};

        function n(i) {
            if (e[i]) return e[i].exports;
            var o = e[i] = {i: i, l: !1, exports: {}};
            return t[i].call(o.exports, o, o.exports, n), o.l = !0, o.exports
        }

        return n.m = t, n.c = e, n.d = function (t, e, i) {
            n.o(t, e) || Object.defineProperty(t, e, {enumerable: !0, get: i})
        }, n.r = function (t) {
            "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {value: "Module"}), Object.defineProperty(t, "__esModule", {value: !0})
        }, n.t = function (t, e) {
            if (1 & e && (t = n(t)), 8 & e) return t;
            if (4 & e && "object" == typeof t && t && t.__esModule) return t;
            var i = Object.create(null);
            if (n.r(i), Object.defineProperty(i, "default", {
                enumerable: !0,
                value: t
            }), 2 & e && "string" != typeof t) for (var o in t) n.d(i, o, function (e) {
                return t[e]
            }.bind(null, o));
            return i
        }, n.n = function (t) {
            var e = t && t.__esModule ? function () {
                return t.default
            } : function () {
                return t
            };
            return n.d(e, "a", e), e
        }, n.o = function (t, e) {
            return Object.prototype.hasOwnProperty.call(t, e)
        }, n.p = "", n(n.s = 6)
    }([function (t, e, n) {
        "use strict";
        n.d(e, "e", (function () {
            return I
        })), n.d(e, "g", (function () {
            return h
        })), n.d(e, "c", (function () {
            return v
        })), n.d(e, "f", (function () {
            return g
        })), n.d(e, "b", (function () {
            return E
        })), n.d(e, "d", (function () {
            return T
        })), n.d(e, "a", (function () {
            return y
        })), n.d(e, "h", (function () {
            return w
        }));
        const i = "undefined" != typeof window,
            o = ("undefined" != typeof wx && wx.getSystemInfoSync, i && window.navigator && window.navigator.userAgent || ""),
            r = /AppleWebKit\/([\d.]+)/i.exec(o), s = (r && parseFloat(r.pop()), /iPad/i.test(o)),
            a = /iPhone/i.test(o) && !s, u = /iPod/i.test(o), c = a || s || u, l = (function () {
                const t = o.match(/OS (\d+)_/i);
                t && t[1] && t[1]
            }(), /Android/i.test(o)), d = function () {
                const t = o.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
                if (!t) return null;
                const e = t[1] && parseFloat(t[1]), n = t[2] && parseFloat(t[2]);
                return e && n ? parseFloat(t[1] + "." + t[2]) : e || null
            }(), f = (l && /webkit/i.test(o), /Firefox/i.test(o), /Edge/i.test(o)), p = !f && /Chrome/i.test(o),
            _ = (function () {
                const t = o.match(/Chrome\/(\d+)/);
                t && t[1] && parseFloat(t[1])
            }(), /MSIE/.test(o), /MSIE\s8\.0/.test(o), function () {
                const t = /MSIE\s(\d+)\.\d/.exec(o);
                let e = t && parseFloat(t[1]);
                !e && /Trident\/7.0/i.test(o) && /rv:11.0/.test(o) && (e = 11)
            }(), /Safari/i.test(o), /TBS\/\d+/i.test(o));
        (function () {
            const t = o.match(/TBS\/(\d+)/i);
            if (t && t[1]) t[1]
        })(), !_ && /MQQBrowser\/\d+/i.test(o), !_ && / QQBrowser\/\d+/i.test(o), /(micromessenger|webbrowser)/i.test(o), /Windows/i.test(o), /MAC OS X/i.test(o), /MicroMessenger/i.test(o);
        n(2), n(1);
        const I = function (t) {
            return "map" === D(t)
        }, h = function (t) {
            return "set" === D(t)
        }, v = function (t) {
            return "file" === D(t)
        }, g = function (t) {
            if ("object" != typeof t || null === t) return !1;
            const e = Object.getPrototypeOf(t);
            if (null === e) return !0;
            let n = e;
            for (; null !== Object.getPrototypeOf(n);) n = Object.getPrototypeOf(n);
            return e === n
        }, m = function (t) {
            return "function" == typeof Array.isArray ? Array.isArray(t) : "array" === D(t)
        }, E = function (t) {
            return m(t) || function (t) {
                return null !== t && "object" == typeof t
            }(t)
        }, T = function (t) {
            return t instanceof Error
        }, D = function (t) {
            return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()
        };
        let S = 0;
        Date.now || (Date.now = function () {
            return (new Date).getTime()
        });
        const y = {
            now: function () {
                0 === S && (S = Date.now() - 1);
                const t = Date.now() - S;
                return t > 4294967295 ? (S += 4294967295, Date.now() - S) : t
            }, utc: function () {
                return Math.round(Date.now() / 1e3)
            }
        }, w = function (t) {
            return JSON.stringify(t, ["message", "code"])
        }
    }, function (t, e, n) {
        "use strict";
        n.r(e);
        var i = n(3), o = n(0);
        let r = 0;
        const s = new Map;

        function a() {
            const t = new Date;
            return "TSignaling " + t.toLocaleTimeString("en-US", {hour12: !1}) + "." + function (t) {
                let e;
                switch (t.toString().length) {
                    case 1:
                        e = "00" + t;
                        break;
                    case 2:
                        e = "0" + t;
                        break;
                    default:
                        e = t
                }
                return e
            }(t.getMilliseconds()) + ":"
        }

        const u = {
            _data: [], _length: 0, _visible: !1, arguments2String(t) {
                let e;
                if (1 === t.length) e = a() + t[0]; else {
                    e = a();
                    for (let n = 0, i = t.length; n < i; n++) Object(o.b)(t[n]) ? Object(o.d)(t[n]) ? e += Object(o.h)(t[n]) : e += JSON.stringify(t[n]) : e += t[n], e += " "
                }
                return e
            }, debug: function () {
                if (r <= -1) {
                    const t = this.arguments2String(arguments);
                    u.record(t, "debug"), i.a.debug(t)
                }
            }, log: function () {
                if (r <= 0) {
                    const t = this.arguments2String(arguments);
                    u.record(t, "log"), i.a.log(t)
                }
            }, info: function () {
                if (r <= 1) {
                    const t = this.arguments2String(arguments);
                    u.record(t, "info"), i.a.info(t)
                }
            }, warn: function () {
                if (r <= 2) {
                    const t = this.arguments2String(arguments);
                    u.record(t, "warn"), i.a.warn(t)
                }
            }, error: function () {
                if (r <= 3) {
                    const t = this.arguments2String(arguments);
                    u.record(t, "error"), i.a.error(t)
                }
            }, time: function (t) {
                s.set(t, o.a.now())
            }, timeEnd: function (t) {
                if (s.has(t)) {
                    const e = o.a.now() - s.get(t);
                    return s.delete(t), e
                }
                return i.a.warn(`未找到对应label: ${t}, 请在调用 logger.timeEnd 前，调用 logger.time`), 0
            }, setLevel: function (t) {
                t < 4 && i.a.log(a() + "set level from " + r + " to " + t), r = t
            }, record: function (t, e) {
                1100 === u._length && (u._data.splice(0, 100), u._length = 1e3), u._length++, u._data.push(`${t} [${e}] \n`)
            }, getLog: function () {
                return u._data
            }
        };
        e.default = u
    }, function (t, e, n) {
        "use strict";
        n.r(e);
        e.default = {
            MSG_PRIORITY_HIGH: "High",
            MSG_PRIORITY_NORMAL: "Normal",
            MSG_PRIORITY_LOW: "Low",
            MSG_PRIORITY_LOWEST: "Lowest",
            KICKED_OUT_MULT_ACCOUNT: "multipleAccount",
            KICKED_OUT_MULT_DEVICE: "multipleDevice",
            KICKED_OUT_USERSIG_EXPIRED: "userSigExpired",
            NET_STATE_CONNECTED: "connected",
            NET_STATE_CONNECTING: "connecting",
            NET_STATE_DISCONNECTED: "disconnected",
            ENTER_ROOM_SUCCESS: "JoinedSuccess",
            ALREADY_IN_ROOM: "AlreadyInGroup"
        }
    }, function (t, e, n) {
        "use strict";
        (function (t) {
            let n, i;
            n = "undefined" != typeof console ? console : void 0 !== t && t.console ? t.console : "undefined" != typeof window && window.console ? window.console : {};
            const o = function () {
                },
                r = ["assert", "clear", "count", "debug", "dir", "dirxml", "error", "exception", "group", "groupCollapsed", "groupEnd", "info", "log", "markTimeline", "profile", "profileEnd", "table", "time", "timeEnd", "timeStamp", "trace", "warn"];
            let s = r.length;
            for (; s--;) i = r[s], console[i] || (n[i] = o);
            n.methods = r, e.a = n
        }).call(this, n(9))
    }, function (t, e, n) {
        "use strict";
        Object.defineProperty(e, "__esModule", {value: !0});
        e.default = {
            NEW_INVITATION_RECEIVED: "ts_new_invitation_received",
            INVITEE_ACCEPTED: "ts_invitee_accepted",
            INVITEE_REJECTED: "ts_invitee_rejected",
            INVITATION_CANCELLED: "ts_invitation_cancelled",
            INVITATION_TIMEOUT: "ts_invitation_timeout",
            SDK_READY: "ts_im_ready",
            SDK_NOT_READY: "ts_im_not_ready",
            TEXT_MESSAGE_RECEIVED: "ts_text_message_received",
            CUSTOM_MESSAGE_RECEIVED: "ts_custom_message_received",
            REMOTE_USER_JOIN: "ts_remote_user_join",
            REMOTE_USER_LEAVE: "ts_remote_user_leave",
            KICKED_OUT: "ts_kicked_out",
            NET_STATE_CHANGE: "ts_net_state_change"
        }
    }, function (t, e) {
        function n(t) {
            return t = window.localStorage ? localStorage.getItem(t) || sessionStorage.getItem(t) : (t = document.cookie.match(new RegExp("(?:^|;\\s)" + t + "=(.*?)(?:;\\s|$)"))) ? t[1] : ""
        }

        function i(t, e, n) {
            if (window.localStorage) try {
                n ? localStorage.setItem(t, e) : sessionStorage.setItem(t, e)
            } catch (t) {
            } else document.cookie = t + "=" + e + ";path=/;domain=" + function () {
                var t = window.location.host, e = t.split(".");
                return 2 < e.length && (t = ({
                    "com.cn": 1,
                    "js.cn": 1,
                    "net.cn": 1,
                    "gov.cn": 1,
                    "com.hk": 1,
                    "co.nz": 1
                }[e.slice(-2).join(".")] ? e.slice(-3) : e.slice(-2)).join(".")), t
            }() + (n ? ";expires=" + n : "")
        }

        function o(t, e) {
            var n, i = {};
            if (void 0 === e) var o = window.location, r = o.host, s = o.pathname, a = o.search.substr(1),
                u = o.hash; else r = (o = e.match(/\w+:\/\/((?:[\w-]+\.)+\w+)(?::\d+)?(\/[^\?\\"'\|:<>]*)?(?:\?([^'"\\<>#]*))?(?:#(\w+))?/i) || [])[1], s = o[2], a = o[3], u = o[4];
            return void 0 !== u && (u = u.replace(/"|'|<|>/gi, "M")), a && function () {
                for (var t = a.split("&"), e = 0, n = t.length; e < n; e++) if (-1 != t[e].indexOf("=")) {
                    var o = t[e].indexOf("="), r = t[e].slice(0, o);
                    o = t[e].slice(o + 1), i[r] = o
                }
            }(), a = function () {
                if (void 0 === a) return a;
                for (var e = a.split("&"), n = [], i = 0, o = e.length; i < o; i++) if (-1 != e[i].indexOf("=")) {
                    var r = e[i].indexOf("="), s = e[i].slice(0, r);
                    r = e[i].slice(r + 1), t.ignoreParams && -1 != t.ignoreParams.indexOf(s) || n.push(s + "=" + r)
                }
                return n.join("&")
            }(), u && function () {
                for (var t = 0 == u.indexOf("#") ? u.substr(1).split("&") : u.split("&"), e = 0, i = t.length; e < i; e++) if (-1 != t[e].indexOf("=")) {
                    var o = t[e].indexOf("="), r = t[e].slice(0, o);
                    if (o = t[e].slice(o + 1), "adtag" === r.toLowerCase()) {
                        n = o;
                        break
                    }
                }
            }(), {host: r, path: s, search: a, hash: u, param: i, adtag: n}
        }

        function r(t) {
            var e, r = o(t), a = {
                dm: r.host,
                pvi: "",
                si: "",
                url: r.path,
                arg: encodeURIComponent(r.search || "").substr(0, 512),
                ty: 0
            };
            return a.pvi = function () {
                var e = new Date((new Date).getTime() + 63072e6).toGMTString();
                if (t.userReport) {
                    var o = n("pgv_uid");
                    o && o == t.user.user_id || (a.ty = 1, i("pgv_uid", t.user.user_id, e)), o = t.user.user_id
                } else (o = n("pgv_pvi")) || (a.ty = 1, i("pgv_pvi", o = s(), e));
                return o
            }(), a.si = ((e = n("pgv_si")) || i("pgv_si", e = s("s")), e), a.url = function () {
                var e = r.path;
                return t.senseQuery && (e += r.search ? "?" + encodeURIComponent(r.search || "").substr(0, 512) : ""), t.senseHash && (e += r.hash ? encodeURIComponent(r.hash) : ""), e
            }(), a
        }

        function s(t) {
            for (var e = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], n = 10; 1 < n; n--) {
                var i = Math.floor(10 * Math.random()), o = e[i];
                e[i] = e[n - 1], e[n - 1] = o
            }
            for (n = i = 0; 5 > n; n++) i = 10 * i + e[n];
            return (t || "") + (i + "") + +new Date
        }

        function a(t) {
            return {r2: t.sid}
        }

        function u(t) {
            var e = {};
            if (t) {
                var n, i = [];
                for (n in t) t.hasOwnProperty(n) && i.push(encodeURIComponent(n) + "=" + encodeURIComponent(t[n]));
                t = i.join(";"), e.ext = t
            }
            return e
        }

        function c(t) {
            var e = o(t, document.referrer);
            return t = o(t), {
                rdm: e.host,
                rurl: e.path,
                rarg: encodeURIComponent(e.search || "").substr(0, 512),
                adt: t.param.ADTAG || t.param.adtag || t.param.CKTAG || t.param.cktag || t.param.PTAG || t.param.ptag || t.adtag
            }
        }

        function l() {
            try {
                var t = navigator, e = screen || {width: "", height: "", colorDepth: ""}, n = {
                    scr: e.width + "x" + e.height,
                    scl: e.colorDepth + "-bit",
                    lg: (t.language || t.userLanguage).toLowerCase(),
                    tz: (new Date).getTimezoneOffset() / 60
                }
            } catch (t) {
                return {}
            }
            return n
        }

        t.exports = {
            conf: {}, version: "2.0.19", init: function (t) {
                var e = {
                    sid: 0,
                    cid: 0,
                    autoReport: 0,
                    senseHash: 0,
                    senseQuery: 0,
                    userReport: 0,
                    performanceMonitor: 0,
                    ignoreParams: []
                };
                if (t) for (var n in t) t.hasOwnProperty(n) && e.hasOwnProperty(n) && (e[n] = t[n]);
                this.conf = e, this.conf.autoReport && this.pgv()
            }, pgv: function () {
                var t = this.conf, e = [], n = this.version;
                if (t.sid) if (!t.userReport || t.user && t.user.user_id && !parseInt(t.user.user_id, 10) !== conf.user.user_id) {
                    for (var i = 0, o = [r(t), c(t), a(t), l(), u({version: n}), {random: +new Date}], s = o.length; i < s; i++) for (var d in o[i]) o[i].hasOwnProperty(d) && e.push(d + "=" + (void 0 === o[i][d] ? "" : o[i][d]));
                    var f = function (t) {
                        t = "https://pingtas.qq.com/webview/pingd?" + t.join("&").toLowerCase();
                        var e = new Image;
                        e.onload = e.onerror = e.onabort = function () {
                            e = e.onload = e.onerror = e.onabort = null
                        }, e.src = t
                    };
                    f(e), t.performanceMonitor && (e = function () {
                        for (var e = function () {
                            if (window.performance) {
                                var t = window.performance.timing, e = {value: t.domainLookupEnd - t.domainLookupStart},
                                    n = {value: t.connectEnd - t.connectStart},
                                    i = {value: t.responseStart - (t.requestStart || t.responseStart + 1)},
                                    o = t.responseEnd - t.responseStart;
                                t.domContentLoadedEventStart ? 0 > o && (o = 0) : o = -1, t = {
                                    domainLookupTime: e,
                                    connectTime: n,
                                    requestTime: i,
                                    resourcesLoadedTime: {value: o},
                                    domParsingTime: {value: t.domContentLoadedEventStart ? t.domInteractive - t.domLoading : -1},
                                    domContentLoadedTime: {value: t.domContentLoadedEventStart ? t.domContentLoadedEventStart - t.fetchStart : -1}
                                }
                            } else t = "";
                            return t
                        }(), i = [], o = [], s = 0, a = [r(t), {r2: t.cid}, l(), {random: +new Date}], c = a.length; s < c; s++) for (var d in a[s]) a[s].hasOwnProperty(d) && o.push(d + "=" + (void 0 === a[s][d] ? "" : a[s][d]));
                        for (d in e) e.hasOwnProperty(d) && ("domContentLoadedTime" == d ? o.push("r3=" + e[d].value) : i.push(e[d].value));
                        e = u({pfm: i.join("_"), version: n}), o.push("ext=" + e.ext), f(o)
                    }, void 0 !== window.performance && void 0 !== window.performance.timing && 0 != window.performance.timing.loadEventEnd ? e() : window.attachEvent ? window.attachEvent("onload", e) : window.addEventListener && window.addEventListener("load", e, !1))
                } else console.log("MTA H5分析错误提示：您选择了用户统计uv，请设置业务的user_id，需为int类型"); else console.log("MTA H5分析错误提示：您没有设置sid")
            }, clickStat: function (t, e) {
                var n = this.conf, i = [], o = r(n), s = a(n);
                if (n.cid) {
                    o.dm = "taclick", o.url = t, s.r2 = n.cid, s.r5 = function (t) {
                        t = void 0 === t ? {} : t;
                        var e, n = [];
                        for (e in t) t.hasOwnProperty(e) && n.push(e + "=" + encodeURIComponent(t[e]));
                        return n.join(";")
                    }(e);
                    var d = 0;
                    for (o = (n = [o, c(n), s, l(), u({version: this.version}), {random: +new Date}]).length; d < o; d++) for (var f in n[d]) n[d].hasOwnProperty(f) && i.push(f + "=" + (void 0 === n[d][f] ? "" : n[d][f]));
                    i = "https://pingtas.qq.com/webview/pingd?" + i.join("&");
                    var p = new Image;
                    p.onload = p.onerror = p.onabort = function () {
                        p = p.onload = p.onerror = p.onabort = null
                    }, p.src = i
                } else console.log("MTA H5分析错误提示：您没有设置cid,请到管理台开通自定义事件并更新统计代码")
            }, clickShare: function (t) {
                var e, n, i = this.conf, s = o(i),
                    d = void 0 === (s = s.param.CKTAG || s.param.ckatg) ? [] : s.split(".");
                if (i.cid) {
                    s = [];
                    var f = r(i), p = a(i);
                    for (f.dm = "taclick_share", f.url = "mtah5-share-" + t, p.r2 = i.cid, p.r5 = (n = [], 2 === (e = d).length && "mtah5_share" == e[0] && n.push(e[0] + "=" + e[1]), n.join(";")), t = 0, f = (i = [f, c(i), p, l(), u({version: this.version}), {random: +new Date}]).length; t < f; t++) for (var _ in i[t]) i[t].hasOwnProperty(_) && s.push(_ + "=" + (void 0 === i[t][_] ? "" : i[t][_]));
                    _ = "https://pingtas.qq.com/webview/pingd?" + s.join("&");
                    var I = new Image;
                    I.onload = I.onerror = I.onabort = function () {
                        I = I.onload = I.onerror = I.onabort = null
                    }, I.src = _
                } else console.log("MTA H5分析错误提示：您没有设置cid,请到管理台开通自定义事件并更新统计代码")
            }
        }
    }, function (t, e, n) {
        "use strict";
        var i = this && this.__awaiter || function (t, e, n, i) {
            return new (n || (n = Promise))((function (o, r) {
                function s(t) {
                    try {
                        u(i.next(t))
                    } catch (t) {
                        r(t)
                    }
                }

                function a(t) {
                    try {
                        u(i.throw(t))
                    } catch (t) {
                        r(t)
                    }
                }

                function u(t) {
                    var e;
                    t.done ? o(t.value) : (e = t.value, e instanceof n ? e : new n((function (t) {
                        t(e)
                    }))).then(s, a)
                }

                u((i = i.apply(t, e || [])).next())
            }))
        }, o = this && this.__generator || function (t, e) {
            var n, i, o, r, s = {
                label: 0, sent: function () {
                    if (1 & o[0]) throw o[1];
                    return o[1]
                }, trys: [], ops: []
            };
            return r = {
                next: a(0),
                throw: a(1),
                return: a(2)
            }, "function" == typeof Symbol && (r[Symbol.iterator] = function () {
                return this
            }), r;

            function a(r) {
                return function (a) {
                    return function (r) {
                        if (n) throw new TypeError("Generator is already executing.");
                        for (; s;) try {
                            if (n = 1, i && (o = 2 & r[0] ? i.return : r[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, r[1])).done) return o;
                            switch (i = 0, o && (r = [2 & r[0], o.value]), r[0]) {
                                case 0:
                                case 1:
                                    o = r;
                                    break;
                                case 4:
                                    return s.label++, {value: r[1], done: !1};
                                case 5:
                                    s.label++, i = r[1], r = [0];
                                    continue;
                                case 7:
                                    r = s.ops.pop(), s.trys.pop();
                                    continue;
                                default:
                                    if (!(o = s.trys, (o = o.length > 0 && o[o.length - 1]) || 6 !== r[0] && 2 !== r[0])) {
                                        s = 0;
                                        continue
                                    }
                                    if (3 === r[0] && (!o || r[1] > o[0] && r[1] < o[3])) {
                                        s.label = r[1];
                                        break
                                    }
                                    if (6 === r[0] && s.label < o[1]) {
                                        s.label = o[1], o = r;
                                        break
                                    }
                                    if (o && s.label < o[2]) {
                                        s.label = o[2], s.ops.push(r);
                                        break
                                    }
                                    o[2] && s.ops.pop(), s.trys.pop();
                                    continue
                            }
                            r = e.call(t, s)
                        } catch (t) {
                            r = [6, t], i = 0
                        } finally {
                            n = o = 0
                        }
                        if (5 & r[0]) throw r[1];
                        return {value: r[0] ? r[1] : void 0, done: !0}
                    }([r, a])
                }
            }
        };
        Object.defineProperty(e, "__esModule", {value: !0});
        var r = n(7), s = n(8), a = n(4), u = n(2), c = n(1), l = n(10), d = n(11), f = n(12), p = n(13), _ = n(15),
            I = n(16).version, h = function () {
                function t(t) {
                    if (this._outerEmitter = null, this._safetyCallbackFactory = null, this._tim = null, this._imSDKAppID = 0, this._userID = null, this._groupID = "", this._isHandling = !1, this._inviteInfoMap = new Map, c.default.info("TSignaling version:" + I), l.default(t.SDKAppID)) return c.default.error("TSignaling 请传入 SDKAppID !!!"), null;
                    this._outerEmitter = new s.default, this._outerEmitter._emit = this._outerEmitter.emit, this._outerEmitter.emit = function (t, e) {
                        var n = arguments[0], i = [n, {name: arguments[0], data: arguments[1]}];
                        this._outerEmitter._emit.apply(this._outerEmitter, i)
                    }.bind(this), this._safetyCallbackFactory = new d.default, t.tim ? this._tim = t.tim : this._tim = _.create({SDKAppID: t.SDKAppID}), this._imSDKAppID = t.SDKAppID, this._tim.on(_.EVENT.SDK_READY, this._onIMReady.bind(this)), this._tim.on(_.EVENT.SDK_NOT_READY, this._onIMNotReady.bind(this)), this._tim.on(_.EVENT.KICKED_OUT, this._onKickedOut.bind(this)), this._tim.on(_.EVENT.NET_STATE_CHANGE, this._onNetStateChange.bind(this)), this._tim.on(_.EVENT.MESSAGE_RECEIVED, this._onMessageReceived.bind(this))
                }

                return t.prototype.setLogLevel = function (t) {
                    c.default.setLevel(t), this._tim.setLogLevel(t)
                }, t.prototype.login = function (t) {
                    return i(this, void 0, void 0, (function () {
                        return o(this, (function (e) {
                            return c.default.log("TSignaling.login", t), this._userID = t.userID, [2, this._tim.login(t)]
                        }))
                    }))
                }, t.prototype.logout = function () {
                    return i(this, void 0, void 0, (function () {
                        return o(this, (function (t) {
                            return c.default.log("TSignaling.logout"), this._userID = "", this._inviteInfoMap.clear(), [2, this._tim.logout()]
                        }))
                    }))
                }, t.prototype.on = function (t, e, n) {
                    c.default.log("TSignaling.on eventName:" + t), this._outerEmitter.on(t, this._safetyCallbackFactory.defense(t, e, n), n)
                }, t.prototype.joinGroup = function (t) {
                    return i(this, void 0, void 0, (function () {
                        return o(this, (function (e) {
                            return c.default.log("TSignaling.joinGroup groupID:" + t), this._groupID = t, [2, this._tim.joinGroup({groupID: t})]
                        }))
                    }))
                }, t.prototype.quitGroup = function (t) {
                    return i(this, void 0, void 0, (function () {
                        return o(this, (function (e) {
                            return c.default.log("TSignaling.quitGroup groupID:" + t), [2, this._tim.quitGroup(t)]
                        }))
                    }))
                }, t.prototype.sendTextMessage = function (t) {
                    return i(this, void 0, void 0, (function () {
                        var e;
                        return o(this, (function (n) {
                            return e = this._tim.createTextMessage({
                                to: t.to,
                                conversationType: !0 === t.groupFlag ? _.TYPES.CONV_GROUP : _.TYPES.CONV_C2C,
                                priority: t.priority || _.TYPES.MSG_PRIORITY_NORMAL,
                                payload: {text: t.text}
                            }), [2, this._tim.sendMessage(e)]
                        }))
                    }))
                }, t.prototype.sendCustomMessage = function (t) {
                    return i(this, void 0, void 0, (function () {
                        var e;
                        return o(this, (function (n) {
                            return e = this._tim.createCustomMessage({
                                to: t.to,
                                conversationType: !0 === t.groupFlag ? _.TYPES.CONV_GROUP : _.TYPES.CONV_C2C,
                                priority: t.priority || _.TYPES.MSG_PRIORITY_NORMAL,
                                payload: {
                                    data: t.data || "",
                                    description: t.description || "",
                                    extension: t.extension || ""
                                }
                            }), [2, this._tim.sendMessage(e)]
                        }))
                    }))
                }, t.prototype.invite = function (t) {
                    return i(this, void 0, void 0, (function () {
                        var e, n, i, s, a, u;
                        return o(this, (function (o) {
                            switch (o.label) {
                                case 0:
                                    return e = p.generate(), c.default.log("TSignaling.invite", t, "inviteID=" + e), l.default(t) || l.default(t.userID) ? [2, Promise.reject({
                                        code: r.ErrorCode.ERR_INVALID_PARAMETERS,
                                        message: "userID is invalid"
                                    })] : (n = t.userID, i = t.data, s = t.timeout, a = {
                                        businessID: r.BusinessID.SIGNAL,
                                        inviteID: e,
                                        inviter: this._userID,
                                        actionType: r.ActionType.INVITE,
                                        inviteeList: [n],
                                        data: i,
                                        timeout: l.default(s) ? 0 : s,
                                        groupID: ""
                                    }, [4, this._sendCustomMessage(n, a)]);
                                case 1:
                                    return 0 === (u = o.sent()).code ? (c.default.log("TSignaling.invite ok"), this._inviteInfoMap.set(e, a), this._startTimer(a, !0), [2, {
                                        inviteID: e,
                                        code: u.code,
                                        data: u.data
                                    }]) : [2, u]
                            }
                        }))
                    }))
                }, t.prototype.inviteInGroup = function (t) {
                    return i(this, void 0, void 0, (function () {
                        var e, n, i, s, a, u, d;
                        return o(this, (function (o) {
                            switch (o.label) {
                                case 0:
                                    return e = p.generate(), c.default.log("TSignaling.inviteInGroup", t, "inviteID=" + e), l.default(t) || l.default(t.groupID) ? [2, Promise.reject({
                                        code: r.ErrorCode.ERR_INVALID_PARAMETERS,
                                        message: "groupID is invalid"
                                    })] : (n = t.groupID, i = t.inviteeList, s = t.data, a = t.timeout, u = {
                                        businessID: r.BusinessID.SIGNAL,
                                        inviteID: e,
                                        inviter: this._userID,
                                        actionType: r.ActionType.INVITE,
                                        inviteeList: i,
                                        data: s,
                                        timeout: l.default(a) ? 0 : a,
                                        groupID: n
                                    }, [4, this._sendCustomMessage(n, u)]);
                                case 1:
                                    return 0 === (d = o.sent()).code ? (c.default.log("TSignaling.inviteInGroup ok"), this._inviteInfoMap.set(e, u), this._startTimer(u, !0), [2, {
                                        inviteID: e,
                                        code: d.code,
                                        data: d.data
                                    }]) : [2, d]
                            }
                        }))
                    }))
                }, t.prototype.cancel = function (t) {
                    return i(this, void 0, void 0, (function () {
                        var e, n, i, s, a, u, d, f, p;
                        return o(this, (function (o) {
                            switch (o.label) {
                                case 0:
                                    return c.default.log("TSignaling.cancel", t), l.default(t) || l.default(t.inviteID) || !this._inviteInfoMap.has(t.inviteID) || this._isHandling ? [2, Promise.reject({
                                        code: r.ErrorCode.ERR_SDK_SIGNALING_INVALID_INVITE_ID,
                                        message: "inviteID is invalid or invitation has been processed"
                                    })] : [3, 1];
                                case 1:
                                    return this._isHandling = !0, e = t.inviteID, n = t.data, i = this._inviteInfoMap.get(e), s = i.inviter, a = i.groupID, u = i.inviteeList, s !== this._userID ? [3, 3] : (d = {
                                        businessID: r.BusinessID.SIGNAL,
                                        inviteID: e,
                                        inviter: s,
                                        actionType: r.ActionType.CANCEL_INVITE,
                                        inviteeList: u,
                                        data: n,
                                        timeout: 0,
                                        groupID: a
                                    }, f = a || u[0], [4, this._sendCustomMessage(f, d)]);
                                case 2:
                                    return p = o.sent(), this._isHandling = !1, p && 0 === p.code ? (c.default.log("TSignaling.cancel ok"), this._deleteInviteInfoByID(e), [2, {
                                        inviteID: e,
                                        code: p.code,
                                        data: p.data
                                    }]) : [2, p];
                                case 3:
                                    return c.default.error("TSignaling.cancel unmatched inviter=" + s + " and userID=" + this._userID), this._isHandling = !1, [2, Promise.reject({
                                        code: r.ErrorCode.ERR_SDK_SIGNALING_NO_PERMISSION,
                                        message: "信令请求无权限，比如取消非自己发起的邀请，接受或则拒绝非发给自己的邀请"
                                    })]
                            }
                        }))
                    }))
                }, t.prototype.accept = function (t) {
                    return i(this, void 0, void 0, (function () {
                        var e, n, i, s, a, u, d, f;
                        return o(this, (function (o) {
                            switch (o.label) {
                                case 0:
                                    return c.default.log("TSignaling.accept", t), l.default(t) || l.default(t.inviteID) || !this._inviteInfoMap.has(t.inviteID) || this._isHandling ? [2, Promise.reject({
                                        code: r.ErrorCode.ERR_SDK_SIGNALING_INVALID_INVITE_ID,
                                        message: "inviteID is invalid or invitation has been processed"
                                    })] : [3, 1];
                                case 1:
                                    return this._isHandling = !0, e = t.inviteID, n = t.data, i = this._inviteInfoMap.get(e), s = i.inviter, a = i.groupID, i.inviteeList.includes(this._userID) ? (u = {
                                        businessID: r.BusinessID.SIGNAL,
                                        inviteID: e,
                                        inviter: s,
                                        actionType: r.ActionType.ACCEPT_INVITE,
                                        inviteeList: [this._userID],
                                        data: n,
                                        timeout: 0,
                                        groupID: a
                                    }, d = a || s, [4, this._sendCustomMessage(d, u)]) : [3, 3];
                                case 2:
                                    return f = o.sent(), this._isHandling = !1, f && 0 === f.code ? (c.default.log("TSignaling.accept ok"), this._updateLocalInviteInfo(u), [2, {
                                        inviteID: e,
                                        code: f.code,
                                        data: f.data
                                    }]) : [2, f];
                                case 3:
                                    return c.default.error("TSignaling.accept inviteeList do not include userID=" + this._userID + ". inviteID=" + e + " groupID=" + a), this._isHandling = !1, [2, Promise.reject({
                                        code: r.ErrorCode.ERR_SDK_SIGNALING_INVALID_INVITE_ID,
                                        message: "inviteID is invalid or invitation has been processed"
                                    })]
                            }
                        }))
                    }))
                }, t.prototype.reject = function (t) {
                    return i(this, void 0, void 0, (function () {
                        var e, n, i, s, a, u, d, f;
                        return o(this, (function (o) {
                            switch (o.label) {
                                case 0:
                                    return c.default.log("TSignaling.reject", t), l.default(t) || l.default(t.inviteID) || !this._inviteInfoMap.has(t.inviteID) || this._isHandling ? [2, Promise.reject({
                                        code: r.ErrorCode.ERR_SDK_SIGNALING_INVALID_INVITE_ID,
                                        message: "inviteID is invalid or invitation has been processed"
                                    })] : [3, 1];
                                case 1:
                                    return this._isHandling = !0, e = t.inviteID, n = t.data, i = this._inviteInfoMap.get(e), s = i.inviter, a = i.groupID, i.inviteeList.includes(this._userID) ? (u = {
                                        businessID: r.BusinessID.SIGNAL,
                                        inviteID: e,
                                        inviter: s,
                                        actionType: r.ActionType.REJECT_INVITE,
                                        inviteeList: [this._userID],
                                        data: n,
                                        timeout: 0,
                                        groupID: a
                                    }, d = a || s, [4, this._sendCustomMessage(d, u)]) : [3, 3];
                                case 2:
                                    return f = o.sent(), this._isHandling = !1, f && 0 === f.code ? (c.default.log("TSignaling.reject ok"), this._updateLocalInviteInfo(u), [2, {
                                        inviteID: e,
                                        code: f.code,
                                        data: f.data
                                    }]) : [2, f];
                                case 3:
                                    return c.default.error("TSignaling.reject inviteeList do not include userID=" + this._userID + ". inviteID=" + e + " groupID=" + a), this._isHandling = !1, [2, Promise.reject({
                                        code: r.ErrorCode.ERR_SDK_SIGNALING_INVALID_INVITE_ID,
                                        message: "inviteID is invalid or invitation has been processed"
                                    })]
                            }
                        }))
                    }))
                }, t.prototype._stat = function () {
                    f.default.clickStat("sdkappid", {value: this._imSDKAppID}), f.default.clickStat("tsignaling_version", {value: I}), f.default.pgv()
                }, t.prototype._onIMReady = function (t) {
                    c.default.log("TSignaling._onIMReady"), this._stat(), this._outerEmitter.emit(a.default.SDK_READY)
                }, t.prototype._onIMNotReady = function (t) {
                    c.default.log("TSignaling.onSdkNotReady"), this._outerEmitter.emit(a.default.SDK_NOT_READY)
                }, t.prototype._onKickedOut = function (t) {
                    c.default.log("TSignaling._onKickedOut"), this._outerEmitter.emit(a.default.KICKED_OUT, t.data)
                }, t.prototype._onNetStateChange = function (t) {
                    c.default.log("TSignaling._onNetStateChange"), this._outerEmitter.emit(a.default.NET_STATE_CHANGE, t.data)
                }, t.prototype._onMessageReceived = function (t) {
                    var e = this, n = t.data, i = n.filter((function (t) {
                        return t.type === _.TYPES.MSG_TEXT
                    }));
                    l.default(i) || this._outerEmitter.emit(a.default.TEXT_MESSAGE_RECEIVED, i);
                    var o = n.filter((function (t) {
                        return t.type === _.TYPES.MSG_GRP_TIP && t.payload.operationType === _.TYPES.GRP_TIP_MBR_JOIN
                    }));
                    l.default(o) || this._outerEmitter.emit(a.default.REMOTE_USER_JOIN, o);
                    var s = n.filter((function (t) {
                        return t.type === _.TYPES.MSG_GRP_TIP && t.payload.operationType === _.TYPES.GRP_TIP_MBR_QUIT
                    }));
                    l.default(s) || this._outerEmitter.emit(a.default.REMOTE_USER_LEAVE, s);
                    var u = n.filter((function (t) {
                        return t.type === _.TYPES.MSG_CUSTOM
                    })), d = [];
                    u.forEach((function (t) {
                        var n, i = t.payload.data, o = !0;
                        try {
                            n = JSON.parse(i)
                        } catch (t) {
                            o = !1
                        }
                        if (o) {
                            var s = n.businessID, a = n.actionType;
                            if (1 === s) switch (a) {
                                case r.ActionType.INVITE:
                                    e._onNewInvitationReceived(n);
                                    break;
                                case r.ActionType.REJECT_INVITE:
                                    e._onInviteeRejected(n);
                                    break;
                                case r.ActionType.ACCEPT_INVITE:
                                    e._onInviteeAccepted(n);
                                    break;
                                case r.ActionType.CANCEL_INVITE:
                                    e._onInvitationCancelled(n);
                                    break;
                                case r.ActionType.INVITE_TIMEOUT:
                                    e._onInvitationTimeout(n)
                            } else {
                                if ("av_call" === s) return !0;
                                c.default.warn("TSignaling._onMessageReceived unknown businessID=" + s), d.push(t)
                            }
                        } else d.push(t)
                    })), l.default(d) || this._outerEmitter.emit(a.default.CUSTOM_MESSAGE_RECEIVED, d)
                }, t.prototype._hasLocalInviteInfo = function (t, e) {
                    var n = t.inviteID, i = t.groupID;
                    if (!this._inviteInfoMap.has(n)) return !1;
                    var o = this._inviteInfoMap.get(n).inviteeList;
                    return !i || (e ? o.length > 0 : o.length > 0 && o.includes(this._userID))
                }, t.prototype._startTimer = function (t, e) {
                    var n = this;
                    void 0 === e && (e = !0);
                    var i = t.timeout;
                    if (c.default.log("TSignaling._startTimer timeout=" + i + " isInvitator=" + e), 0 !== i) var o = e ? i + 5 : i,
                        r = 1, s = setInterval((function () {
                            var i = n._hasLocalInviteInfo(t, e);
                            r < o && i ? ++r : (i && n._sendTimeoutNotice(t, e), clearInterval(s))
                        }), 1e3)
                }, t.prototype._sendTimeoutNotice = function (t, e) {
                    return i(this, void 0, void 0, (function () {
                        var n, i, s, u, l, d, f, p;
                        return o(this, (function (o) {
                            switch (o.label) {
                                case 0:
                                    return n = t.inviteID, i = t.groupID, s = t.inviteeList, u = t.inviter, l = t.data, d = e ? i || s[0] : i || u, c.default.log("TSignaling._sendTimeoutNotice inviteID=" + n + " to=" + d + " isInvitator=" + e), f = {
                                        businessID: r.BusinessID.SIGNAL,
                                        inviteID: n,
                                        inviter: u,
                                        actionType: r.ActionType.INVITE_TIMEOUT,
                                        inviteeList: e ? s : [this._userID],
                                        data: l,
                                        timeout: 0,
                                        groupID: i
                                    }, [4, this._sendCustomMessage(d, f)];
                                case 1:
                                    return (p = o.sent()) && 0 === p.code && (this._outerEmitter.emit(a.default.INVITATION_TIMEOUT, {
                                        inviter: u,
                                        inviteID: n,
                                        groupID: i,
                                        inviteeList: f.inviteeList,
                                        isSelfTimeout: !0
                                    }), e ? this._deleteInviteInfoByID(n) : this._updateLocalInviteInfo(f)), [2, p]
                            }
                        }))
                    }))
                }, t.prototype._onNewInvitationReceived = function (e) {
                    var n = e.inviteID, i = e.inviter, o = e.inviteeList, r = e.groupID, s = e.data,
                        a = o.includes(this._userID);
                    c.default.log("TSignaling._onNewInvitationReceived", e, "myselfIncluded=" + a);
                    var u = JSON.parse(s);
                    !r || 0 !== u.call_end && !l.default(u.room_id) ? (r && a || !r) && (this._inviteInfoMap.set(n, e), this._outerEmitter.emit(t.EVENT.NEW_INVITATION_RECEIVED, {
                        inviteID: n,
                        inviter: i,
                        groupID: r,
                        inviteeList: o,
                        data: e.data || ""
                    }), this._startTimer(e, !1)) : this._outerEmitter.emit(t.EVENT.NEW_INVITATION_RECEIVED, {
                        inviteID: n,
                        inviter: i,
                        groupID: r,
                        inviteeList: o,
                        data: e.data || ""
                    })
                }, t.prototype._onInviteeRejected = function (t) {
                    var e = t.inviteID, n = t.inviter, i = t.groupID, o = this._inviteInfoMap.has(e);
                    c.default.log("TSignaling._onInviteeRejected inviteID=" + e + " hasInviteID=" + o + " inviter=" + n + " groupID=" + i), (i && o || !i) && (this._updateLocalInviteInfo(t), this._outerEmitter.emit(a.default.INVITEE_REJECTED, {
                        inviteID: e,
                        inviter: n,
                        groupID: i,
                        invitee: t.inviteeList[0],
                        data: t.data || ""
                    }))
                }, t.prototype._onInviteeAccepted = function (t) {
                    var e = t.inviteID, n = t.inviter, i = t.groupID, o = this._inviteInfoMap.has(e);
                    c.default.log("TSignaling._onInviteeAccepted inviteID=" + e + " hasInviteID=" + o + " inviter=" + n + " groupID=" + i), (i && o || !i) && (this._updateLocalInviteInfo(t), this._outerEmitter.emit(a.default.INVITEE_ACCEPTED, {
                        inviteID: e,
                        inviter: n,
                        groupID: i,
                        invitee: t.inviteeList[0],
                        data: t.data || ""
                    }))
                }, t.prototype._onInvitationCancelled = function (t) {
                    var e = t.inviteID, n = t.inviter, i = t.groupID, o = this._inviteInfoMap.has(e);
                    c.default.log("TSignaling._onInvitationCancelled inviteID=" + e + " hasInviteID=" + o + " inviter=" + n + " groupID=" + i), (i && o || !i) && (this._deleteInviteInfoByID(e), this._outerEmitter.emit(a.default.INVITATION_CANCELLED, {
                        inviteID: e,
                        inviter: n,
                        groupID: i,
                        data: t.data || ""
                    }))
                }, t.prototype._onInvitationTimeout = function (t) {
                    var e = t.inviteID, n = t.inviter, i = t.groupID, o = this._inviteInfoMap.has(e);
                    c.default.log("TSignaling._onInvitationTimeout inviteID=" + e + " hasInviteID=" + o + " inviter=" + n + " groupID=" + i), (i && o || !i) && (this._updateLocalInviteInfo(t), this._outerEmitter.emit(a.default.INVITATION_TIMEOUT, {
                        inviteID: e,
                        inviter: n,
                        groupID: i,
                        inviteeList: t.inviteeList,
                        isSelfTimeout: !1
                    }))
                }, t.prototype._updateLocalInviteInfo = function (t) {
                    var e = t.inviteID, n = t.inviter, i = t.inviteeList, o = t.groupID;
                    if (c.default.log("TSignaling._updateLocalInviteInfo inviteID=" + e + " inviter=" + n + " groupID=" + o), o) {
                        if (this._inviteInfoMap.has(e)) {
                            var r = i[0], s = this._inviteInfoMap.get(e).inviteeList;
                            s.includes(r) && (s.splice(s.indexOf(r), 1), c.default.log("TSignaling._updateLocalInviteInfo remove " + r + " from localInviteeList. " + s.length + " invitees left")), 0 === s.length && this._deleteInviteInfoByID(e)
                        }
                    } else this._deleteInviteInfoByID(e)
                }, t.prototype._deleteInviteInfoByID = function (t) {
                    this._inviteInfoMap.has(t) && (c.default.log("TSignaling._deleteInviteInfoByID remove " + t + " from inviteInfoMap."), this._inviteInfoMap.delete(t))
                }, t.prototype._sendCustomMessage = function (t, e) {
                    return i(this, void 0, void 0, (function () {
                        var n, i;
                        return o(this, (function (o) {
                            return n = e.groupID, i = this._tim.createCustomMessage({
                                to: t,
                                conversationType: n ? _.TYPES.CONV_GROUP : _.TYPES.CONV_C2C,
                                priority: _.TYPES.MSG_PRIORITY_HIGH,
                                payload: {data: JSON.stringify(e)}
                            }), e.actionType === r.ActionType.INVITE ? [2, this._tim.sendMessage(i, {
                                offlinePushInfo: {
                                    title: "",
                                    description: "您有一个通话请求",
                                    androidOPPOChannelID: ""
                                }
                            })] : [2, this._tim.sendMessage(i)]
                        }))
                    }))
                }, t.EVENT = a.default, t.TYPES = u.default, t
            }();
        e.default = h
    }, function (t, e, n) {
        "use strict";
        var i, o, r;
        Object.defineProperty(e, "__esModule", {value: !0}), e.ErrorCode = e.BusinessID = e.ActionType = void 0, function (t) {
            t[t.INVITE = 1] = "INVITE", t[t.CANCEL_INVITE = 2] = "CANCEL_INVITE", t[t.ACCEPT_INVITE = 3] = "ACCEPT_INVITE", t[t.REJECT_INVITE = 4] = "REJECT_INVITE", t[t.INVITE_TIMEOUT = 5] = "INVITE_TIMEOUT"
        }(i || (i = {})), e.ActionType = i, function (t) {
            t[t.SIGNAL = 1] = "SIGNAL"
        }(o || (o = {})), e.BusinessID = o, function (t) {
            t[t.ERR_INVALID_PARAMETERS = 6017] = "ERR_INVALID_PARAMETERS", t[t.ERR_SDK_SIGNALING_INVALID_INVITE_ID = 8010] = "ERR_SDK_SIGNALING_INVALID_INVITE_ID", t[t.ERR_SDK_SIGNALING_NO_PERMISSION = 8011] = "ERR_SDK_SIGNALING_NO_PERMISSION"
        }(r || (r = {})), e.ErrorCode = r
    }, function (t, e, n) {
        "use strict";
        n.r(e), n.d(e, "default", (function () {
            return s
        }));
        const i = Function.prototype.apply, o = new WeakMap;

        function r(t) {
            return o.has(t) || o.set(t, {}), o.get(t)
        }

        class s {
            constructor(t = null, e = console) {
                const n = r(this);
                return n._events = new Set, n._callbacks = {}, n._console = e, n._maxListeners = null === t ? null : parseInt(t, 10), this
            }

            _addCallback(t, e, n, i) {
                return this._getCallbacks(t).push({
                    callback: e,
                    context: n,
                    weight: i
                }), this._getCallbacks(t).sort((t, e) => t.weight > e.weight), this
            }

            _getCallbacks(t) {
                return r(this)._callbacks[t]
            }

            _getCallbackIndex(t, e) {
                return this._has(t) ? this._getCallbacks(t).findIndex(t => t.callback === e) : null
            }

            _achieveMaxListener(t) {
                return null !== r(this)._maxListeners && r(this)._maxListeners <= this.listenersNumber(t)
            }

            _callbackIsExists(t, e, n) {
                const i = this._getCallbackIndex(t, e), o = -1 !== i ? this._getCallbacks(t)[i] : void 0;
                return -1 !== i && o && o.context === n
            }

            _has(t) {
                return r(this)._events.has(t)
            }

            on(t, e, n = null, i = 1) {
                const o = r(this);
                if ("function" != typeof e) throw new TypeError(e + " is not a function");
                return this._has(t) ? (this._achieveMaxListener(t) && o._console.warn(`Max listeners (${o._maxListeners}) for event "${t}" is reached!`), this._callbackIsExists(...arguments) && o._console.warn(`Event "${t}" already has the callback ${e}.`)) : (o._events.add(t), o._callbacks[t] = []), this._addCallback(...arguments), this
            }

            once(t, e, n = null, o = 1) {
                const r = (...o) => (this.off(t, r), i.call(e, n, o));
                return this.on(t, r, n, o)
            }

            off(t, e = null) {
                const n = r(this);
                let i;
                return this._has(t) && (null === e ? (n._events.delete(t), n._callbacks[t] = null) : (i = this._getCallbackIndex(t, e), -1 !== i && (n._callbacks[t].splice(i, 1), this.off(...arguments)))), this
            }

            emit(t, ...e) {
                return this._has(t) && this._getCallbacks(t).forEach(t => i.call(t.callback, t.context, e)), this
            }

            clear() {
                const t = r(this);
                return t._events.clear(), t._callbacks = {}, this
            }

            listenersNumber(t) {
                return this._has(t) ? this._getCallbacks(t).length : null
            }
        }
    }, function (t, e) {
        var n;
        n = function () {
            return this
        }();
        try {
            n = n || new Function("return this")()
        } catch (t) {
            "object" == typeof window && (n = window)
        }
        t.exports = n
    }, function (t, e, n) {
        "use strict";
        n.r(e);
        var i = n(0);
        const o = Object.prototype.hasOwnProperty;
        e.default = function (t) {
            if (null == t) return !0;
            if ("boolean" == typeof t) return !1;
            if ("number" == typeof t) return 0 === t;
            if ("string" == typeof t) return 0 === t.length;
            if ("function" == typeof t) return 0 === t.length;
            if (Array.isArray(t)) return 0 === t.length;
            if (t instanceof Error) return "" === t.message;
            if (Object(i.f)(t)) {
                for (const e in t) if (o.call(t, e)) return !1;
                return !0
            }
            return !!(Object(i.e)(t) || Object(i.g)(t) || Object(i.c)(t)) && 0 === t.size
        }
    }, function (t, e, n) {
        "use strict";
        n.r(e);
        var i = n(1), o = n(4), r = n.n(o);
        e.default = class {
            constructor() {
                this._funcMap = new Map
            }

            defense(t, e, n) {
                if ("string" != typeof t) return null;
                if (0 === t.length) return null;
                if ("function" != typeof e) return null;
                if (this._funcMap.has(t) && this._funcMap.get(t).has(e)) return this._funcMap.get(t).get(e);
                this._funcMap.has(t) || this._funcMap.set(t, new Map);
                let i = null;
                return this._funcMap.get(t).has(e) ? i = this._funcMap.get(t).get(e) : (i = this._pack(t, e, n), this._funcMap.get(t).set(e, i)), i
            }

            defenseOnce(t, e, n) {
                return "function" != typeof e ? null : this._pack(t, e, n)
            }

            find(t, e) {
                return "string" != typeof t || 0 === t.length || "function" != typeof e ? null : this._funcMap.has(t) ? this._funcMap.get(t).has(e) ? this._funcMap.get(t).get(e) : (i.default.log(`SafetyCallback.find: 找不到 func —— ${t}/${"" !== e.name ? e.name : "[anonymous]"}`), null) : (i.default.log(`SafetyCallback.find: 找不到 eventName-${t} 对应的 func`), null)
            }

            delete(t, e) {
                return "function" == typeof e && (!!this._funcMap.has(t) && (!!this._funcMap.get(t).has(e) && (this._funcMap.get(t).delete(e), 0 === this._funcMap.get(t).size && this._funcMap.delete(t), !0)))
            }

            _pack(t, e, n) {
                return function () {
                    try {
                        e.apply(n, Array.from(arguments))
                    } catch (e) {
                        const n = Object.values(r.a).indexOf(t), o = Object.keys(r.a)[n];
                        i.default.error(`接入侧事件 EVENT.${o} 对应的回调函数逻辑存在问题，请检查！`, e)
                    }
                }
            }
        }
    }, function (t, e, n) {
        "use strict";
        n.r(e);
        var i = n(5), o = n.n(i);
        o.a.init({
            sid: "500721619",
            cid: "500721777",
            autoReport: 0,
            senseHash: 0,
            senseQuery: 0,
            performanceMonitor: 0,
            ignoreParams: []
        }), e.default = o.a
    }, function (t, e, n) {
        /**
         * UUID.js - RFC-compliant UUID Generator for JavaScript
         *
         * @file
         * @author  LiosK
         * @version v4.2.5
         * @license Apache License 2.0: Copyright (c) 2010-2020 LiosK
         */
        var i;
        i = function (e) {
            "use strict";

            function i() {
                var t = o._getRandomInt;
                this.timestamp = 0, this.sequence = t(14), this.node = 1099511627776 * (1 | t(8)) + t(40), this.tick = t(4)
            }

            function o() {
            }

            return o.generate = function () {
                var t = o._getRandomInt, e = o._hexAligner;
                return e(t(32), 8) + "-" + e(t(16), 4) + "-" + e(16384 | t(12), 4) + "-" + e(32768 | t(14), 4) + "-" + e(t(48), 12)
            }, o._getRandomInt = function (t) {
                if (t < 0 || t > 53) return NaN;
                var e = 0 | 1073741824 * Math.random();
                return t > 30 ? e + 1073741824 * (0 | Math.random() * (1 << t - 30)) : e >>> 30 - t
            }, o._hexAligner = function (t, e) {
                for (var n = t.toString(16), i = e - n.length, o = "0"; i > 0; i >>>= 1, o += o) 1 & i && (n = o + n);
                return n
            }, o.overwrittenUUID = e, function () {
                var t = o._getRandomInt;
                o.useMathRandom = function () {
                    o._getRandomInt = t
                };
                var e = null, i = t;
                "undefined" != typeof window && (e = window.crypto || window.msCrypto) ? e.getRandomValues && "undefined" != typeof Uint32Array && (i = function (t) {
                    if (t < 0 || t > 53) return NaN;
                    var n = new Uint32Array(t > 32 ? 2 : 1);
                    return n = e.getRandomValues(n) || n, t > 32 ? n[0] + 4294967296 * (n[1] >>> 64 - t) : n[0] >>> 32 - t
                }) : (e = n(14)) && e.randomBytes && (i = function (t) {
                    if (t < 0 || t > 53) return NaN;
                    var n = e.randomBytes(t > 32 ? 8 : 4), i = n.readUInt32BE(0);
                    return t > 32 ? i + 4294967296 * (n.readUInt32BE(4) >>> 64 - t) : i >>> 32 - t
                }), o._getRandomInt = i
            }(), o.FIELD_NAMES = ["timeLow", "timeMid", "timeHiAndVersion", "clockSeqHiAndReserved", "clockSeqLow", "node"], o.FIELD_SIZES = [32, 16, 16, 8, 8, 48], o.genV4 = function () {
                var t = o._getRandomInt;
                return (new o)._init(t(32), t(16), 16384 | t(12), 128 | t(6), t(8), t(48))
            }, o.parse = function (t) {
                var e;
                if (e = /^\s*(urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(\})?\s*$/i.exec(t)) {
                    var n = e[1] || "", i = e[8] || "";
                    if (n + i === "" || "{" === n && "}" === i || "urn:uuid:" === n.toLowerCase() && "" === i) return (new o)._init(parseInt(e[2], 16), parseInt(e[3], 16), parseInt(e[4], 16), parseInt(e[5], 16), parseInt(e[6], 16), parseInt(e[7], 16))
                }
                return null
            }, o.prototype._init = function () {
                var t = o.FIELD_NAMES, e = o.FIELD_SIZES, n = o._binAligner, i = o._hexAligner;
                this.intFields = new Array(6), this.bitFields = new Array(6), this.hexFields = new Array(6);
                for (var r = 0; r < 6; r++) {
                    var s = parseInt(arguments[r] || 0);
                    this.intFields[r] = this.intFields[t[r]] = s, this.bitFields[r] = this.bitFields[t[r]] = n(s, e[r]), this.hexFields[r] = this.hexFields[t[r]] = i(s, e[r] >>> 2)
                }
                return this.version = this.intFields.timeHiAndVersion >>> 12 & 15, this.bitString = this.bitFields.join(""), this.hexNoDelim = this.hexFields.join(""), this.hexString = this.hexFields[0] + "-" + this.hexFields[1] + "-" + this.hexFields[2] + "-" + this.hexFields[3] + this.hexFields[4] + "-" + this.hexFields[5], this.urn = "urn:uuid:" + this.hexString, this
            }, o._binAligner = function (t, e) {
                for (var n = t.toString(2), i = e - n.length, o = "0"; i > 0; i >>>= 1, o += o) 1 & i && (n = o + n);
                return n
            }, o.prototype.toString = function () {
                return this.hexString
            }, o.prototype.equals = function (t) {
                if (!(t instanceof o)) return !1;
                for (var e = 0; e < 6; e++) if (this.intFields[e] !== t.intFields[e]) return !1;
                return !0
            }, o.NIL = (new o)._init(0, 0, 0, 0, 0, 0), o.genV1 = function () {
                null == o._state && o.resetState();
                var t = (new Date).getTime(), e = o._state;
                t != e.timestamp ? (t < e.timestamp && e.sequence++, e.timestamp = t, e.tick = o._getRandomInt(4)) : Math.random() < o._tsRatio && e.tick < 9984 ? e.tick += 1 + o._getRandomInt(4) : e.sequence++;
                var n = o._getTimeFieldValues(e.timestamp), i = n.low + e.tick, r = 4095 & n.hi | 4096;
                e.sequence &= 16383;
                var s = e.sequence >>> 8 | 128, a = 255 & e.sequence;
                return (new o)._init(i, n.mid, r, s, a, e.node)
            }, o.resetState = function () {
                o._state = new i
            }, o._tsRatio = 1 / 4, o._state = null, o._getTimeFieldValues = function (t) {
                var e = t - Date.UTC(1582, 9, 15), n = e / 4294967296 * 1e4 & 268435455;
                return {low: 1e4 * (268435455 & e) % 4294967296, mid: 65535 & n, hi: n >>> 16, timestamp: e}
            }, "object" == typeof t.exports && (t.exports = o), o
        }(i)
    }, function (t, e) {
    }, function (e, n) {
        e.exports = t
    }, function (t) {
        t.exports = JSON.parse('{"name":"tsignaling","version":"0.4.0","description":"腾讯云 Web 信令 SDK","main":"./src/index.ts","scripts":{"ts2js":"tsc src/index.ts --outDir build/ts2js","doc":"npm run ts2js && npm run doc:clean && npm run doc:build","doc:build":"./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json && node ./build/jsdoc/fix-doc.js","doc:clean":"node ./build/jsdoc/clean-doc.js","build:wx":"cross-env NODE_ENV=wx webpack --config webpack.prod.config.js","build:web":"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack/bin/webpack.js --config webpack.prod.config.js","build:package":"node build/package-bundle.js","prerelease":"npm run build:web && npm run build:wx && npm run build:package && node ./build/copy.js","start:wx":"cross-env NODE_ENV=wx  webpack-dev-server --config webpack.config.js","start:web":"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.dev.config.js","build_withcopy":"npm run build:web && cp dist/npm/tsignaling-js.js ../TIM-demo-web/node_modules/tsignaling/tsignaling-js.js","build_withcopy:mp":"npm run build:wx && cp dist/npm/tsignaling-wx.js ../TIM-demo-mini/static/component/TRTCCalling/utils/tsignaling-wx.js"},"keywords":["腾讯云","即时通信","信令"],"author":"","license":"ISC","devDependencies":{"cross-env":"^7.0.2","fs-extra":"^9.0.1","html-webpack-plugin":"^4.3.0","ts-loader":"^7.0.5","typescript":"^3.9.3","webpack":"^4.43.0","webpack-cli":"^3.3.11","webpack-dev-server":"^3.11.0"},"dependencies":{"EventEmitter":"^1.0.0","docdash-blue":"^1.1.3","jsdoc":"^3.6.4","jsdoc-plugin-typescript":"^2.0.5","mta-h5-analysis":"^2.0.15","pretty":"^2.0.0","replace":"^1.2.0","tim-js-sdk":"^2.8.1","tim-wx-sdk":"^2.8.1","uuidjs":"^4.2.5"}}')
    }]).default
}));